package com.zzb.ucenter.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzb.ucenter.model.po.XcMenu;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author itcast
 */
public interface XcMenuMapper extends BaseMapper<XcMenu> {

    @Select("select xm.*\n" +
            "        from xc_user_role xur\n" +
            "                 left join xc_role xr on xur.role_id = xr.id\n" +
            "                 left join xc_permission xp on xr.id = xp.role_id\n" +
            "                 left join xc_menu xm on xp.menu_id = xm.id\n" +
            "        where xur.user_id = #{userId}")
    List<XcMenu> selectPermissionByUserId(@Param("userId") String id);
}
